//
//  UploadRiskMessage.m
//  SulitLoan
//
//  Created by 虞嘉伟 on 2025/3/12.
//  
  

#import "UploadRiskMessage.h"

@implementation UploadRiskMessage

- (NSString *)name {
    return @"xiaoliuRa";
}
- (instancetype)initWithController:(UIViewController *)controller {
    if (self = [super init]) {
        self.controller = controller;
    }
    return self;
}
- (void)handleMessage:(WKScriptMessage *)message {
    if ([message.name isEqualToString:self.name]) {
        NSArray *param = message.body;
        if (![param isKindOfClass:NSArray.class]) {
            return;
        }
        NSString *productID = param.firstObject;
        NSString *orderNo = param.lastObject;
        
        Analysis.loanEnd.start = NSDate.date;
        Analysis.loanEnd.end = NSDate.date;
        [SLLocationService startLocationWithCompletion:^(CGFloat lat, CGFloat lon) {
            [Analysis sendDataWithProductID:productID time:Analysis.loanEnd];
        }];
    }
}

@end
